package com.qms.repast.ui.activity;

import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.qms.repast.R;
import com.qms.repast.ui.base.BaseActivity;
import com.qms.repast.ui.presenter.GenderPresenter;
import com.qms.repast.ui.view.IGenderView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author 泅渡者
 * @date 2018/9/14 0014
 * @describe: 性别选择界面
 */
public class GenderActivity extends BaseActivity<GenderPresenter> implements IGenderView {
	@BindView(R.id.iv_finish)
	ImageView ivFinish;
	@BindView(R.id.tv_male)
	TextView tvMale;
	@BindView(R.id.iv_male_isShow)
	ImageView ivMaleIsShow;
	@BindView(R.id.tv_female)
	TextView tvFemale;
	@BindView(R.id.iv_female_isShow)
	ImageView ivFemaleIsShow;
	@BindView(R.id.tv_secret)
	TextView tvSecret;
	@BindView(R.id.iv_secret_isShow)
	ImageView ivSecretIsShow;

	@Override
	protected int initLayout () {
		return R.layout.activity_gender;
	}

	@Override
	protected void initPresenter (Intent intent) {
		mPresenter = new GenderPresenter(this, this);
	}

	@Override
	protected void initView () {

	}

	@Override
	protected void initData () {

	}

	@OnClick({R.id.iv_finish, R.id.tv_male, R.id.tv_female, R.id.tv_secret})
	public void onViewClicked (View view) {
		switch (view.getId()) {
			case R.id.iv_finish:
				finish();
				break;
			case R.id.tv_male:
				changeStyles(tvMale, tvFemale, tvSecret);
				changeVisibity(ivMaleIsShow, ivFemaleIsShow, ivSecretIsShow);
				break;
			case R.id.tv_female:
				changeStyles(tvFemale, tvMale, tvSecret);
				changeVisibity(ivFemaleIsShow, ivMaleIsShow, ivSecretIsShow);
				break;
			case R.id.tv_secret:
				changeStyles(tvSecret, tvMale, tvFemale);
				changeVisibity(ivSecretIsShow, ivMaleIsShow, ivFemaleIsShow);
				break;
			default:
				break;
		}
	}

	private void changeStyles (TextView arg0, TextView arg1, TextView arg2) {
		arg0.setTextColor(ContextCompat.getColor(this, R.color.theme_orange));
		arg1.setTextColor(ContextCompat.getColor(this, R.color.theme_black));
		arg2.setTextColor(ContextCompat.getColor(this, R.color.theme_black));

	}

	private void changeVisibity (ImageView arg0, ImageView arg1, ImageView arg2) {
		arg0.setVisibility(View.VISIBLE);
		arg1.setVisibility(View.GONE);
		arg2.setVisibility(View.GONE);

	}
}
